#ifndef ORTHOGRAPHICCAMERA_H
#define ORTHOGRAPHICCAMERA_H

#include "Renderer/camera.h"
#include <glm/glm.hpp>
#include "Core/base.h"

namespace CC
{

    class CC_EXPORT OrthographicCamera : public Camera
    {
    public:
        OrthographicCamera(const glm::mat4 &projection);
        OrthographicCamera(float left, float right, float bottom, float top);
        ~OrthographicCamera();

        void OnUpdate(Timestep ts);
        void OnEvent(Event &e);

        void SetProjection(float left, float right, float bottom, float top);

        glm::vec3 GetPosition() const { return m_Position; }
        void SetPosition(const glm::vec3 &position)
        {
            m_Position = position;
            RecalculateViewMatrix();
        }

        float GetRotation() const { return m_Rotation; }
        void SetRotation(float rotation)
        {
            m_Rotation = rotation;
            RecalculateViewMatrix();
        }

        const glm::mat4 &GetViewMatrix() const { return m_ViewMatrix; }
        const glm::mat4 &GetViewProjectionMatrix() const { return m_ViewProjectionMatrix; }

    private:
        void RecalculateViewMatrix();
        void OnWindowResize(WindowResizeEvent& e);

    private:
        glm::mat4 m_ViewMatrix;
        glm::mat4 m_ViewProjectionMatrix;

        glm::vec3 m_Position = {0.0f, 0.0f, 0.0f};
        float m_Rotation = 0.0f;
    };

}
#endif